<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	template="/templates/default.xhtml">
	<ui:define name="content">
		<h1>Class Information</h1>
		<div>
			<p>Name: #{classesController.clazz.name}</p>
			<p>Start Date: #{classesController.clazz.startDate}</p>
			<p>End Date: #{classesController.clazz.endDate}</p>
			<p>Semester: #{classesController.clazz.semester.name}</p>
			<p>Subject: #{classesController.clazz.subject.name}</p>
			<p>Max Students: #{classesController.clazz.maxStudents}</p>
		</div>
		
		<h1>Add Student into Class</h1>
		<h:form id="enroll" method="post">
			<div><h:outputLabel value="#{classesController.errorMsg}" class="error" /></div>
			<div class="box-body">
		        <div class="form-group">
		            <label for="name">Student ID</label>
		            <h:inputText name="studentId" class="form-control" value="#{classesController.studentId}"/>
		        </div>
			</div>
			<div class="box-footer">
	            <h:commandButton action="#{classesController.doAddStudent}" value="Add" styleClass="btn btn-primary"/>
	           	<h:commandButton value="Clear" type="reset" styleClass="btn"/>
	        </div>
		</h:form>
		
		<h1>Student In Class</h1>
		<h:form id="class">
			<div class="box-body">
				<div class="form-group">
					<h:dataTable value="#{classesController.clazz.getStudents()}" var="_student"
						styleClass="table table-bordered">
						<h:column>
							<f:facet name="header">Id</f:facet>
							<div class="center">#{_student.id}</div>
						</h:column>
						<h:column>
							<f:facet name="header">Student ID</f:facet>
							<div class="center">#{_student.studentId}</div>
						</h:column>
						<h:column>
							<f:facet name="header">First Name</f:facet>
							#{_student.firstName}
						</h:column>
						<h:column>
							<f:facet name="header">Last Name</f:facet>
							#{_student.lastName}
						</h:column>
						<h:column>
							<f:facet name="header">Address</f:facet>
							#{_student.address}
						</h:column>
					</h:dataTable>
				</div>
			</div>
		</h:form>
	</ui:define>
</ui:composition>